package org.jeie.actions;

import java.awt.Graphics;
import java.awt.image.BufferedImage;

import org.jeie.main.Action;
import org.jeie.messages.Messages;

public class VerticalFlipAction implements Action {

	public BufferedImage apply(BufferedImage img) {
		return flipVertical(img);
	}
	public String getName() {
		return Messages.getString("Action.VerticalFlip"); //$NON-NLS-1$
	}
	public static BufferedImage flipVertical(BufferedImage img) {
		int w = img.getWidth();
		int h = img.getHeight();
		BufferedImage newIMG = new BufferedImage(w, h, img.getColorModel()
			.getTransparency());
		Graphics g = newIMG.createGraphics();
		g.drawImage(img, 0, 0, w, h, 0, h, w, 0, null);
		g.dispose();
		return newIMG;
	}
}
